package cn.com.egova.demoapplication.tools;

import android.animation.TypeEvaluator;

import cn.com.egova.demoapplication.bean.Point;

/**
 * Created by yuanchao on 2017/3/8.
 */

public class PointSinEvaluator implements TypeEvaluator<Point> {

    @Override
    public Point evaluate(float fraction, Point startValue, Point endValue) {
        int x = (int) (startValue.getX() + fraction * (endValue.getX() - startValue.getX()));
        //将x转变成弧度单位.由于sin(x)函数的y值太小,不便于观察,故扩大100倍. y=sin(x)+z
        int y = (int) (Math.sin(x * Math.PI / 180) * 100) + endValue.getY() / 2;
        Point point = new Point(x,y);
        return point;
    }
}
